<template>
	<div class="todo-container">
		<div class="todo-wrap">
			<Header :addTodo="addTodo"/>
			<List :todos="todos"/>
			<Footer/>
		</div>
	</div>
</template>

<script>
	import Header from './components/Header'
	import List from './components/List'
	import Footer from './components/Footer'

	export default {
		name: 'App',
		components:{Header,List,Footer},
		data(){
			return{
				todos:[
					{id:'001',title:'吃饭',done:true},
					{id:'002',title:'睡觉',done:false},
					{id:'003',title:'打台球',done:true},
					{id:'004',title:'打代码',done:false},
				]
			}
		},
		methods: {
			//添加一个todo
			addTodo(todoObj){
				this.todos.unshift(todoObj)
			}
		},
	}
</script>
